package training_process.TrainingIV;

/**
 * Author by KyrieC
 * Created by sheting on 2023/11/21
 */
public abstract class BinaryOperation {
    protected int operand1;
    protected int operand2;

    public BinaryOperation(int operand1, int operand2) {
        this.operand1 = operand1;
        this.operand2 = operand2;
    }

    public abstract int getResult();

    public abstract String getOperator();

    @Override
    public String toString() {
        if (operand1 > operand2)
            return operand1 + " " + getOperator() + " " + operand2 + " = ";
        return operand2 + " " + getOperator() + " " + operand1 + " = ";
    }
}

